home *** CD-ROM | disk | FTP | other *** search
- /* TrackScrap.c */
- /*
- * Copyright © 1989 Martin Minow. All rights reserved.
- *
- * OSErr
- * TrackFromScrap()
- *
- * Copy the desk scrap to the Track private scrap.
- * Return noErr if successful, else an error code.
- *
- * OSErr
- * TrackToScrap()
- *
- * Copy the Track private scrap to the desk scrap.
- * Return noErr if successful, else an error code.
- *
- * Handle
- * TrackScrapHandle()
- *
- * Return a handle to the Track private scrap.
- *
- * LONGINT
- * TrackGetScrapLen()
- *
- * Return the length of the Track private scrap in bytes.
- *
- * TrackSetScrapLen(length)
- * LONGINT length;
- *
- * Set the size of the Track private scrap. This will
- * call SetHandleSize() on the track handle.
- */
-
- #include "TrackEdit.h"
-
- /*
- * TrackFromScrap()
- * If there is a TEXT item in the desk scrap, read it in
- * and store it in the Track private scrap. Return
- * the error status (noErr is normal, noTypErr means
- * there wasn't any TEXT in the scrap, anything is
- * is trouble.
- */
- OSErr
- TrackFromScrap()
- {
- long offset;
- Handle scrap;
- long status;
-
- SetHandleSize(TrackScrpHandle, 0);
- status = GetScrap(TrackScrpHandle, 'TEXT', &offset);
- if (status >= 0) {
- TrackScrpLength = status;
- status = noErr;
- }
- return (status);
- }
-
- /*
- * TrackToScrap()
- * Copy the current selection to the Desk scrap. Return
- * noErr if ok, else an error code.
- */
- OSErr
- TrackToScrap()
- {
- OSErr status;
-
- MoveHHi(TrackScrpHandle);
- HLock(TrackScrpHandle);
- status = PutScrap(
- TrackScrpLength, 'TEXT', *TrackScrpHandle);
- HUnlock(TrackScrpHandle);
- return (status);
- }
-
- /*
- * Handle
- * TrackScrapHandle()
- *
- * Return a handle to the Track private scrap. Note:
- * this is the *real* handle, not a copy.
- */
- Handle
- TrackScrapHandle()
- {
- return (TrackScrpHandle);
- }
-
- /*
- * LONGINT
- * TrackGetScrapLen()
- *
- * Return the length of the Track private scrap in bytes.
- */
- LONGINT
- TrackGetScrapLen()
- {
- return (TrackScrpLength);
- }
-
- /*
- * TrackSetScrapLen(length)
- * LONGINT length;
- *
- * Set the size of the Track private scrap. This will
- * call SetHandleSize() on the track handle.
- */
- void
- TrackSetScrapLen(length)
- LONGINT length;
- {
- SetHandleSize(TrackScrpHandle, length);
- TrackScrpLength = length;
- }
-